#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
#include <fstream>
using namespace std;
int main() {
	ifstream in("input.txt");
	ofstream out("output.txt");
	string s;
	vector <int> a;
	int r = -1, o = 0;
	getline(in, s);
	while (s != "") {
		if (s == "-") {
			if (r > -1) {
				r--;
			}
			else {
				o = 1;
			}
		}
		else {
			a.push_back(0);
			r++;
			a[r] = stoi(s);
		}
		getline(in, s);
	}
	if (o == 1) {
		out << "ERROR";
	}
	else if (r == -1) {
		out << "EMPTY";
	}
	else {
		for (int i = 0; i <= r; i++) {
			out << a[i] << " ";
		}
	}
	in.close();
	out.close();
}